#include <string>
#include <unordered_map>

using namespace std;


/**
 * @brief 242. 有效的字母异位词
 * https://leetcode.cn/problems/valid-anagram/
 */
class Solution {
public:
    bool isAnagram(string s, string t) {
        unordered_map<char, int> table;
        for (char c : s) table[c]++;
        for (char c : t) table[c]--;
        for (auto [c, num] : table) {
            if (num != 0) return false;
        }
        return true;
    }
};
